/**
 * 组合继承
 *  需要调用两次父类实例方法
 */

// function Father (name) {
//   this.name = name
//   this.cars = ['宾利','法拉利','保时捷']
// }

// Father.prototype.sayName = function (){
//   console.log(this.name)
// }

// function Son (name,age){
//   Father.call(this,name)
//   this.age = age
// }
// Son.prototype = new Father()
// Son.prototype.constructor = Son
// Son.prototype.sayAge=function () {
//   console.log(this.age)
// }

// let mySon = new Son('lulu', 20)
// mySon.cars.push('宝马')
// console.log(mySon.cars)
// mySon.sayName()
// mySon.sayAge()

// let mySon2 = new Son('aaa', 30)
// mySon2.cars.push('奔驰')
// console.log(mySon2.cars)
// mySon2.sayName()
// mySon2.sayAge()


// function test (...args) {
//   // console.log(args)
//   console.log(arguments)
// }

// test(1,2,3)
var abc = 'global 云隐'
var obj = {
  abc:'云隐',
  data: {
    name:'lu-lu',
    getDataAbc: () =>{
      console.log('getDataAbc   ',this.abc)
    },
  },
  leader:'你好',
  getAbc: () =>{
    // console.log(this)
    console.log('getAbc   ',this.abc)
  },
  getLeader: function () {
    console.log('getLeader   ',this.leader)
  }
}
console.log(obj.getAbc())
console.log(obj.data.getDataAbc())
console.log(obj.getLeader())
var getabc = obj.getAbc
var getDataAbc = obj.data.getDataAbc
var getLeader = obj.getLeader
getabc()
getDataAbc()
getLeader()
// let cb = obj.getAbc
// console.log(cb())